function [minD,maxD] = minmaxdistances(matrix)
%returns minimal and maximal distance between elements of matrix (collums)

minD = dist(matrix(:,1)',matrix(:,2));
maxD = minD;
for i=1:size(matrix,2)
    for j = i+1:size(matrix,2)
        d = dist(matrix(:,i)',matrix(:,j));
        if ( d > maxD) 
            maxD = d;
        end
        if (d< minD)
            minD = d;
        end
    end
end;

